<?php
class MY_Controller extends CI_Controller{

	function __construct()
	{
		parent::__construct();
		$this->theme = 'default';
		
	}

	function title($title)
	{
		if($title == 'home'){
	 	return $title_text = "YUHUA Shop | 管理页面";
		}else{
			return $title_text = $title." - YUHUA Shop | 管理页面";
		}
	}

	function checkUserStatus()
	{
		if($this->aauth->is_loggedin()){
			if( $this->aauth->is_banned($this->aauth->get_user_id()) ){
				return false;
			}else{
				return true;
			}
		}else{
			return false;
		}
		/*if($this->aauth->control($perm_par = null)){
			if( $this->aauth->is_banned($this->aauth->get_user_id()) ){
				return false;
			}else{
				return true;
			}
		}else{
			return false;
		}*/
	}
	
	 function control( $perm_par = false){

		if($perm_par == null){
			return $this->aauth->is_loggedin();
		}else{
			$perm_id = $this->aauth->get_perm_id($perm_par);
			$this->aauth->update_activity();

			// if user or user's group not allowed
			if ( ! $this->aauth->is_allowed($perm_id) or ! $this->aauth->is_group_allowed($perm_id) ){
				// echo $this->aauth->config_vars['no_access'];
				  //$this->CI->lang->line('no_access');
				return false;
			}else{
				return true;
			}
		}
	}

}